//
//  ViewController.m
//  模态视图Present
//
//  Created by apple on 15/9/14.
//  Copyright (c) 2015年 戴维营. All rights reserved.
//

#import "ViewController.h"
#import "SecondViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    //传递数据
    
    _label = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, 100, 40)];
    
    _label.text = @"默认文字";
    
    
    
    [self.view addSubview:_label];
    
    
    
    
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    
    SecondViewController *secondCtrl = [[SecondViewController alloc] init];
    
    
    [self presentViewController:secondCtrl animated:YES completion:nil];
    
   
    secondCtrl.didAbc = ^(NSString *test)
    {
        _label.text = test;
    };
    
    secondCtrl.aB = ^
    {
        return _label.text;
    };
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
